//
//  ViewController.m
//  catClaw
//
//  Created by iOS Developer 1 on 16/3/11.
//  Copyright © 2016年 Joey. All rights reserved.
//

#import "ViewController.h"
#import "AppDelegate.h"
#import "HTTPServer.h"
#import "MyWebSocket.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *ipLabel;

@end

@implementation ViewController

- (void)awakeFromNib
{
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self showServerIP];
}


- (void)showServerIP
{
    AppDelegate *myApp = DEFAULTAPPDELEGATE;
    [self.ipLabel setText:[NSString stringWithFormat:@"Started HTTP Server\nhttp://%@:%hu", [myApp.httpserver hostName], [myApp.httpserver listeningPort]]];
}



- (void)showMessage {
    
    MyWebSocket *web = [MyWebSocket sharedMyWebSocket];
    if (web.msg.length > 0) {
        DDLogInfo(@"%@",web.msg);
    }else{
        DDLogError(@"并没有信息！");
    }
    DDLogInfo(@"%@",web.msg);
}
- (void)sendMSG {
    
    
    MyWebSocket *web = [MyWebSocket sharedMyWebSocket];
    
    
    [web sendMessage:@"messageFly"];
    
    
}


@end
